﻿#ifndef ADSOCKET_H
#define ADSOCKET_H

#include <QTcpSocket>
#include <QHostAddress>
#include <QAbstractSocket>
#include <QAbstractSocket>
#include <QImage>
#include <QLabel>
#include <QBuffer>
#include <QTime>
#include "string.h"
#include "tcp_MSG.h"



class AdSocket : public QTcpSocket
{
    Q_OBJECT
public:
    explicit AdSocket(QObject *parent = 0);
    ~AdSocket();

    QString address;
    int port;
    int readMsgType;

signals:
    void sig_showWeather(QString city,QString area,QString wt);// 发送天气信息
    void sig_showTxt(QString tcp_Txt);// 发送文字信息
    void sig_showImage(QImage tcp_image);// 发送文字信息
    void sig_showProgressBar(int currentProgress, int finish);// 发送进度条信息
    void GUI_WarningSignal(QString title,QString text,QString buttons,QString defaultButton);//设置警报

public slots:
    void readMsg();// 接收信息
    void conSuc(); // 成功建立连接
    void conAgain();// 重新连接
    void conAgain(QAbstractSocket::SocketError);// 重新连接


private:
    QString id;
    int needFileSize;
    int currentReceiveSize;
    QByteArray currentReceiveByte;
    int milsec;
    QString fileName;
};

#endif // ADSOCKET_H
